package com.yloveg.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yloveg.dao.SRoleMapper;
import com.yloveg.dao.VComplainMapper;
import com.yloveg.dao.VGiftMapper;
import com.yloveg.entity.SRole;
import com.yloveg.entity.VComplain;
import com.yloveg.entity.VGift;
import com.yloveg.service.SRoleService;
import com.yloveg.service.VComplainService;
import com.yloveg.service.VGiftService;

@Service
public class VComplainServiceImpl implements VComplainService {

	@Autowired
    private VComplainMapper vComplainMapper;

	@Override
	public PageInfo<VComplain> queryComplainPage(int page, int limit) {
		PageHelper.startPage(page, limit);
		List<VComplain> vComplainList = vComplainMapper.queryComplain();
		PageInfo<VComplain> resultPage=new PageInfo<VComplain>(vComplainList);
		return resultPage;
	}

	@Override
	public int insertComplain(VComplain vcomplain) {
		vcomplain.setCreateTime(new Date());
		vcomplain.setSts("Y");
		return vComplainMapper.insert(vcomplain);
	}

	@Override
	public VComplain selectByPrimaryKey(Integer id) {
		return vComplainMapper.selectByPrimaryKey(id);
	}

	@Override
	public int getComplainCount() {
		List<VComplain> vComplainList = vComplainMapper.queryComplainToday();
		return vComplainList.size();
	}
	  
	

}
